package com.ibm.cps.jarxs;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;

import com.ibm.util.exception.CPSException;

@Path(ParaUtility.DataSource)
public interface DatasourceResource {

	// ../Datasources/{tenantId:[a-f0-9]{16,16}}
	@GET
	@Path(ParaUtility.TenantFormat)
	Response GetDatasources(@PathParam(ParaUtility.TenantField) String tenantId,
			@Context UriInfo info,
			@HeaderParam(ParaUtility.auth) String key);
	
	// ../Datasources/{tenantId:[a-f0-9]{16,16}}/{datasource_name}
	@GET
	@Path(ParaUtility.TenantFormat + "/" + ParaUtility.DS_format)
	Response GetDatasource(@PathParam(ParaUtility.TenantField) String tenantId,
			@PathParam(ParaUtility.DS_field) String datasource_name,
			@HeaderParam(ParaUtility.auth) String key);
	
	// ../Datasources/{tenantId:[a-f0-9]{16,16}}/{datasource_name} 
	@PUT
	@Path(ParaUtility.TenantFormat + "/" + ParaUtility.DS_format)
	@Consumes(MediaType.APPLICATION_JSON)
	Response PutDatasource(@PathParam(ParaUtility.TenantField) String tenantId,
			@PathParam(ParaUtility.DS_field) String ds,
			@HeaderParam(ParaUtility.auth) String key);
	
	// ../Datasources/{tenantId:[a-f0-9]{16-16}}
	@POST
	@Path(ParaUtility.TenantFormat)
	@Consumes(MediaType.APPLICATION_JSON)
	Response PostDatasource(@PathParam(ParaUtility.TenantField) String tenantId,String json,
			@HeaderParam(ParaUtility.auth) String key);
	
	
	// ../Datasources/{tenantId}
	@DELETE
	@Path(ParaUtility.TenantFormat)
	Response DeleteDatasources(@PathParam(ParaUtility.TenantField) String tenantId,
			@HeaderParam(ParaUtility.auth) String key);
	
	// ../Datasources/{tenantId}/{ds_name}
	@DELETE
	@Path(ParaUtility.TenantFormat + "/" + ParaUtility.DS_format)
	Response DeleteDatasource(@PathParam(ParaUtility.TenantField) String tenantId,
			@PathParam(ParaUtility.DS_field) String ds_name,
			@HeaderParam(ParaUtility.auth) String key);
	
	
}
